package com.aaa.javaweb.dao.impl;

import com.aaa.javaweb.dao.TyssDao;
import com.aaa.javaweb.until.JDBCUntil;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class TyssDaoImpl implements TyssDao {
    @Override
    public List<Map> query() {
        String sql="select ty.id,ty.tname,ty.yj,ty.money,ts.name from t_type ty left JOIN t_roomsheshi trs on ty.id=trs.typeid LEFT JOIN t_sheshi ts on trs.ssid=ts.id";
        return JDBCUntil.selectMap(sql);
    }

    @Override
    public List<Map> selectid(Integer id) {
        String sql="select ts.name from t_type ty left JOIN t_roomsheshi trs on ty.id=trs.typeid LEFT JOIN t_sheshi ts on trs.ssid=ts.id where ty.id=? ";
        return JDBCUntil.selectMap(sql,id);
    }
}
